package cosc617_blackteam;

import java.util.ArrayList;

/**
 * @author Laura
 * Iterates through all comments
 */
public class DefaultCommentIterator implements I_CommentIterator{
	ArrayList<Comment> comments;
	private int index; //index of current Item
	
	public DefaultCommentIterator(ArrayList<Comment> comments){
		index = 0;
		this.comments = comments;	
	}
	
	
	@Override
	public boolean hasNext() {
		//no criteria to filter comments so same as traversing the array
		return index < comments.size() ;
	}

	@Override
	public Comment next() {
		Comment output;
		if(hasNext())
			output = comments.get(index);
		else output = null;
		index++;
		return output;
	}


	@Override
	public void remove() {
		throw new UnsupportedOperationException();
	}

}



